/*
 * @Author: 詹真琦(legendryztachi@gmail.com)
 * @Date: 2022-01-07 15:34:05
 * @LastEditors: 詹真琦(legendryztachi@gmail.com)
 * @LastEditTime: 2022-04-27 18:16:40
 * @FilePath: \code\cwp-front\pc-collaboration\src\mixins\handle-panel.js
 * @Description: 对右侧面板的控制。相关数据、流程预测、流程说明书
 */
// 引入基础数据
import { useBaseInfoStore } from '@/store/modules/base-info';
import { mapState } from 'pinia';
//所有的操作集合
import handleObj from '@/handles/handle-list/create';
export default {
    computed: {
        ...mapState(useBaseInfoStore, ['baseInfo']),
        //展示按钮开关集合
        showBtn() {
            if (!this.baseInfo) return {};
            const list = [
                'hasWorkflowBookPanel',
                'hasRelationDataPanel',
                'hasWorkflowPredictionPanel',
                'hasFormRulePanel',
                'hasPeoplesPanel',
                'hasRecentlyTemplatePanel',
            ];
            const other = this.baseInfo.businessData.other;
            return list.filter((key) => other[key]);
        },
    },
    created() {
        // <!-- 流程说明书里面的iframe高度是这样设置的,醉得不行： -->
        // <!-- $("#displayIframe").height(parent.$('#_main').height() - $('#common_tabs_id').height() - 10); -->
        const main = $('#_main');
        if (!main.length) {
            $('body').append(`<div id="_main"
                style="height:${document.documentElement.offsetHeight - 200}px;display:none;"
        ></div>`);
        }
    },
    methods: {
        /**
         * @description: 展示流程说明书
         * @param {Boolean} isOnlyBook 是否只展示流程说明书
         * @return {*}
         */
        async showHandbook(isOnlyBook) {
            handleObj.showHandbook.call(this, isOnlyBook);
        },
    },
};
